#pragma once
#ifndef __G_TRIANGLE_3_H__
#define __G_TRIANGLE_3_H__

#include "GVector3.h"
#include "GUtilities/GTypes.h"

namespace GMath
{

	class GTriangle3
	{
	public:
		// CW orientation
		GVector3		Point0;
		GVector3		Point1;
		GVector3		Point2;

						GTriangle3();
						GTriangle3(const GVector3& ThePoint0, const GVector3& ThePoint1, const GVector3& ThePoint2);

		void			Create(const GVector3& ThePoint0, const GVector3& ThePoint1, const GVector3& ThePoint2);

		float			GetArea() const;
		GVector3		GetCenter() const;
		GVector3		GetNormal() const;
		
		bool			CheckFront(const GVector3& ViewVec, bool TwoSided = false) const;

		GVector3		GetCoordBarycentric(const GVector3& SurfacePoint) const;
		GVector3		GetCoordEuclidean(const GVector3& BarycentricCoord) const;
	
	};

}

#endif